package main

import "fmt"

/**

channel range close

close 用于通知 for range 关闭。一般只用于for循环

 */

func fillChannelData(c chan int) {
	for i := 0; i < 10; i++ {
		c <- i
	}
	close(c)
}
func main() {
	c := make(chan int)
	go fillChannelData(c)
	for i := range c {
		fmt.Println(i)
	}
}
